<%@ page import="java.net.URLDecoder" %><%--
  Created by IntelliJ IDEA.
  User: HP
  Date: 2021/10/16
  Time: 23:09
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>add</title>
</head>
<body>
<%
    Cookie[] cookies = request.getCookies();
    String[] s = null;

    if (cookies != null) {
        for (Cookie cookie : cookies) {
            if (URLDecoder.decode(cookie.getName(), "utf-8").equals("nameinfo")) {
                String str = URLDecoder.decode(cookie.getValue(), "utf-8");
                s = str.split("-");
            }
        }
    }
    assert s != null;%>
欢迎<%=s[0]%>
<hr/>
<h2 align="center">添加学生</h2>
<hr/>
<form action="StudentServlet" method="post">
    <table width="300">
        <tr>
            <td>学号：</td>
            <td><input type="text" name="id" placeholder="请输入学号"></td>
        </tr>
        <tr>
            <td>姓名：</td>
            <td><input type="text" name="name" placeholder="请输入姓名"></td>
        </tr>
        <tr>
            <td>密码：</td>
            <td><input type="password" name="password" placeholder="请输入密码"></td>
        </tr>
        <tr>
            <td>性别：</td>
            <td><input type="radio" name="sex" value="男">男</td>
            <td><input type="radio" name="sex" value="女">女</td>
        </tr>
        <tr>
            <td>专业：</td>
            <td><select name="major">
                <option value="计算机">计算机</option>
                <option value="金融">金融</option>
                <option value="土木">土木</option>
                <option value="软件工程">软件工程</option>
            </select>
            </td>
        </tr>
        <tr>
            <td>年龄：</td>
            <td><input type="text" name="age"></td>
        </tr>
        <tr>
            <td colspan="2">
                <input type="submit" value="提交">
                <input type="reset" value="重置">
            </td>
        </tr>
    </table>
</form>
</body>
</html>
